//
//  shopListVCCell.m
//  WHB_driver
//
//  Created by 徐国庆 on 15/12/24.
//  Copyright (c) 2015年 turing. All rights reserved.
//

#import "shopListVCCell.h"

@implementation shopListVCCell

- (void)awakeFromNib {
    // Initialization code
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //车牌号
        self.vechileNumberLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.vechileNumberLabel];
        
        // 车标
        self.vechileImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.vechileImageView];
        
        //车名
        self.vechileNameLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.vechileNameLabel];
        
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 40, self.frame.size.width, 305)];
        view.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:view];
        
        //货单号
        self.shipListNumberLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.shipListNumberLabel];
        
        //货单状态
        self.stateLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.stateLabel];
        self.stateLabel.textAlignment = NSTextAlignmentRight;
        
        // 线1
        self.line1 = [[UILabel alloc] init];
        [self.contentView addSubview:self.line1];
        
        //出发地
        self.setoutAddressLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.setoutAddressLabel];
        
        //地址指向图标
        self.addressImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.addressImageView];
        
        //目的地
        self.aimAddressLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.aimAddressLabel];
        
        //介质图标
        self.mediumImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.mediumImageView];
        
        //介质内容
        self.mediumLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.mediumLabel];
        
         //重量图标
        self.weightImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.weightImageView];
        
        //重量
        self.weightLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.weightLabel];
        
        // 接收货物完成
        self.receiveShipOverButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.contentView addSubview:self.receiveShipOverButton];
        [self.receiveShipOverButton setTitle:@"取货完成" forState:UIControlStateNormal];
        self.receiveShipOverButton.layer.masksToBounds = YES;
        self.receiveShipOverButton.layer.cornerRadius = 15;
        
        // 线2
        self.line2 = [[UILabel alloc] init];
        [self.contentView addSubview:self.line2];

        
        //收货方
        self.receiveBusinessLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.receiveBusinessLabel];
        
        //收货方内容
        self.receiveContentLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.receiveContentLabel];
        self.receiveContentLabel.textAlignment = 2;
        
         //是否认证图标
        self.identificationImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.identificationImageView];
        
        // 拨打电话
        self.callingButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.contentView addSubview:self.callingButton];
        [self.callingButton setTitle:@"拨打电话" forState:UIControlStateNormal];
        self.callingButton.layer.masksToBounds = YES;
        self.callingButton.layer.cornerRadius = 15;
        
        // 线3
        self.line3 = [[UILabel alloc] init];
        [self.contentView addSubview:self.line3];
        
        //收货日期
        self.receiveDateLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.receiveDateLabel];
        
        //收货日期内容
        self.receiveDateContentLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.receiveDateContentLabel];
        self.receiveDateContentLabel.textAlignment = 2;
        
        // 线4
        self.line4 = [[UILabel alloc] init];
        [self.contentView addSubview:self.line4];
        
        //收货地址
        self.receiveAddressLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.receiveAddressLabel];
        
        //收货地址内容
        self.receiveAddressContentLabel = [[UILabel alloc] init];
        self.receiveAddressContentLabel.textAlignment = 2;
        [self.contentView addSubview:self.receiveAddressContentLabel];
        
        // 线5
        self.line5 = [[UILabel alloc] init];
        [self.contentView addSubview:self.line5];
        
        //备注
        self.remarkLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.remarkLabel];
        
        //备注内容
        self.remarkContentLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.remarkContentLabel];
        self.remarkContentLabel.textAlignment = 2;
        
        // 线6
        self.line6 = [[UILabel alloc] init];
        [self.contentView addSubview:self.line6];

    }
    return self;
}


- (void)layoutSubviews{
    [super layoutSubviews];
    self.vechileNumberLabel.frame = CGRectMake(10, 0, 300, 40);
    self.vechileImageView.frame = CGRectMake(self.frame.size.width - 140, 0, 40, 40);
    self.vechileNameLabel.frame = CGRectMake(self.frame.size.width - 100, 0, 100, 40);
    self.shipListNumberLabel.frame = CGRectMake(10, CGRectGetMaxY(self.vechileNumberLabel.frame), 200, 40);
    self.stateLabel.frame = CGRectMake(self.frame.size.width - 100, self.shipListNumberLabel.frame.origin.y, 80, 40);
    self.line1.frame = CGRectMake(0, CGRectGetMaxY(self.stateLabel.frame), self.frame.size.width, 0.5);
    self.setoutAddressLabel.frame = CGRectMake(10, CGRectGetMaxY(self.line1.frame), 50, 40);
    self.addressImageView.frame = CGRectMake(CGRectGetMaxX(self.setoutAddressLabel.frame) - 5, self.setoutAddressLabel.frame.origin.y + 15, 25, 14);
    self.aimAddressLabel.frame = CGRectMake(CGRectGetMaxX(self.addressImageView.frame), self.setoutAddressLabel.frame.origin.y, 50, 40);
    
    self.mediumImageView.frame = CGRectMake(10, CGRectGetMaxY(self.setoutAddressLabel.frame) + 0.5, 16, 16);
    self.mediumLabel.frame = CGRectMake(CGRectGetMaxX(self.mediumImageView.frame) + 3, self.mediumImageView.frame.origin.y - 8, 50, 30);
    self.weightImageView.frame = CGRectMake(CGRectGetMaxX(self.mediumLabel.frame), self.mediumImageView.frame.origin.y, 16, 16);
    self.weightLabel.frame = CGRectMake(CGRectGetMaxX(self.weightImageView.frame) + 3, self.weightImageView.frame.origin.y - 8, 50, 30);
    self.receiveShipOverButton.frame = CGRectMake(self.frame.size.width - 150, CGRectGetMaxY(self.line1.frame) + 20, 130, 30);
    self.line2.frame = CGRectMake(10, CGRectGetMaxY(self.mediumLabel.frame), self.frame.size.width - 20, 0.5);
    
    self.receiveBusinessLabel.frame = CGRectMake(10, CGRectGetMaxY(self.line2.frame) + 0.5, 100, 30);
    self.receiveContentLabel.frame = CGRectMake(self.frame.size.width - 150, self.receiveBusinessLabel.frame.origin.y, 100, 30);
    self.identificationImageView.frame = CGRectMake(self.frame.size.width - 30, self.receiveBusinessLabel.frame.origin.y + 8, 13, 13);
    self.callingButton.frame = CGRectMake(self.frame.size.width - 150, CGRectGetMaxY(self.receiveContentLabel.frame), 130, 30);
    self.line3.frame = CGRectMake(10, CGRectGetMaxY(self.callingButton.frame) + 10, self.frame.size.width - 20, 0.5);
    
    self.receiveDateLabel.frame = CGRectMake(10, CGRectGetMaxY(self.line3.frame) + 0.5, 100, 40);
    self.receiveDateContentLabel.frame = CGRectMake(self.frame.size.width - 200, self.receiveDateLabel.frame.origin.y, 180, 40);
    self.line4.frame = CGRectMake(10, CGRectGetMaxY(self.receiveDateLabel.frame) , self.frame.size.width - 20, 0.5);
    
    self.receiveAddressLabel.frame = CGRectMake(10, CGRectGetMaxY(self.line4.frame) + 0.5, 70, 40);
    self.receiveAddressContentLabel.frame = CGRectMake(CGRectGetMaxX(self.receiveAddressLabel.frame) + 20, self.receiveAddressLabel.frame.origin.y, self.frame.size.width - CGRectGetMaxX(self.receiveAddressLabel.frame) - 50, 40);
    self.line5.frame = CGRectMake(10, CGRectGetMaxY(self.receiveAddressLabel.frame) , self.frame.size.width - 20, 0.5);
    
    self.remarkLabel.frame = CGRectMake(10, CGRectGetMaxY(self.line5.frame) + 0.5, 70, 40);
    self.remarkContentLabel.frame  = CGRectMake(CGRectGetMaxX(self.remarkLabel.frame) + 20, self.remarkLabel.frame.origin.y, self.frame.size.width - CGRectGetMaxX(self.remarkLabel.frame) - 40, 40);
    self.line6.frame = CGRectMake(10, CGRectGetMaxY(self.remarkLabel.frame) , self.frame.size.width - 20, 0.5);
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
